package com.qiaofang.applet.service.property.service.mapstruct;

import com.qiaofang.applet.constants.PropertyImageConstants;
import com.qiaofang.applet.service.property.domain.PropertyVr;
import com.qiaofang.applet.service.property.service.dto.PropertyImageDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface PropertyVrMapper {

    default PropertyImageDto domainToImageDto(PropertyVr propertyVr) {
        if (propertyVr == null) {
            return null;
        }

        PropertyImageDto imageDto = new PropertyImageDto();
        imageDto.setImageType(PropertyImageConstants.VR_TYPE.getValue());
        imageDto.setImgUrl(propertyVr.getPreview());
        imageDto.setLinkUrl(propertyVr.getRoamview());

        return imageDto;
    }

}
